AMD/IOMMU: Common the #732/#733 errata handling in iommu_read_log()
authorAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 20 Sep 2018 17:30:34 +0000 (18:30 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 17 Feb 2020 19:10:55 +0000 (19:10 +0000)
commit709d3ddea2d5e750bf1bc889edc76807c364a2d7
tree94a42c2a49bc69990ba736c6034586a820511535
parent707db77a380b96025bae8bc4322da0b64819d3b7
AMD/IOMMU: Common the #732/#733 errata handling in iommu_read_log()

There is no need to have both helpers implement the same workaround.  The size
and layout of the the Event and PPR logs (and others for that matter) share a
lot of commonality.

Use MASK_EXTR() to locate the code field, and use ACCESS_ONCE() rather than
barrier() to prevent hoisting of the repeated read.

Avoid unnecessary zeroing by only clobbering the 'code' field - this alone is
sufficient to spot the errata when the rings wrap.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/drivers/passthrough/amd/iommu_init.c